package com.mjp.learn.design.strategy;

public class Sorter {
    public void sort(Comparable[] a) {
        int length = a.length;
        for(int i = 0 ; i < length ; i ++){
            int minPos = i;
            for(int j = i+1; j< length;j++){
                if(a[j].compareTo(a[minPos]) < 0){
                    minPos = j;
                }
            }
            if(minPos!=i){
                Comparable temp = a[minPos];
                a[minPos] = a[i];
                a[i] = temp;
            }
        }
    }

}
